<?php
$this->headTitle($this->translate('Add page link'));
$this->headLink()
	->appendStylesheet($this->STATIC_SERVER . '/css/ui/jquery-ui-1.8.11.custom.css');
$this->headScript()
	->appendFile($this->STATIC_SERVER . '/js/jquery.ui/jquery-ui.js');
?>
<div class="grid_12"><?php echo $this->flashMessenger(); ?></div>
<div class="grid_12">
	<div class="grid_9 alpha">
		<div id="viewTabs">
				<ul>
					<li><a href="#viewAsList"><span><?php echo $this->translate('View List'); ?></span></a></li>
					<li><a href="#viewAsText"><span><?php echo $this->translate('View text'); ?></span></a></li>
				</ul>
				<div id="viewAsList">
					<form method="post" action="<?php echo $this->url(array(), 'seo_sitemap_delete'); ?>">
					<div>
						<div class="grid_4 alpha">
							<div>
								<input type="checkbox" value="1" id="selectAll" />		
								<?php echo $this->translate('Url'); ?>
							</div>
						</div>
						
						<div class="grid_2"><?php echo $this->translate('Frequency'); ?></div>
						
						<div class="grid_2 omega"><?php echo $this->translate('Priority'); ?></div>
						
						<div class="clear"></div>
					</div>
					
					<?php foreach ($this->items as $item) : ?>
					<div class="clearfix">
						<div class="grid_4 alpha">
							<div>
								<input type="checkbox" name="urls[]" value="<?php echo urlencode($item->getLoc()); ?>" />
								<a href="<?php echo $item->getLoc(); ?>" target="_blank"><?php echo $item->getLoc(); ?></a>
							</div>
						</div>
						
						<div class="grid_2"><?php echo $item->getFrequency(); ?></div>
						
						<div class="grid_2 omega"><?php echo $item->getPriority(); ?></div>
					</div>
					<?php endforeach; ?>
					
					<div class="clearfix">
						<button type="submit"><span><?php echo $this->translate('Submit'); ?></span></button>
					</div>
					</form>
				</div>
				
				<div id="viewAsText">
					<?php if ($this->content) : ?>
					<textarea style="width: 600px; height: 400px"><?php echo $this->content; ?></textarea>
					<?php endif; ?>
				</div>
			</div>
	</div>
	<div class="grid_3 omega">
		<a href="<?php echo $this->url(array(), 'seo_sitemap_add'); ?>"><span><?php echo $this->translate('Add breadcrumb'); ?></span></a>
		<div class="clearfix"></div>
		<?php if($this->items !== null): ?>
			<h3><?php echo $this->translate('More information'); ?></h3>
			<p><?php echo $this->translate('Last Modification:'); ?> <?php echo date("d/m/Y", $this->lastmod); ?></p>
		<?php endif; ?>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$('#viewTabs').tabs();
	
	$('#selectAll').click(function() {
		if ($('#selectAll').attr('checked')) {
			$('#viewAsList').find('input[name="urls[]"]').each(function() {
				$(this).attr('checked', 'checked');
			});
		} else {
			$('#viewAsList').find('input[name="urls[]"]').each(function() {
				$(this).removeAttr('checked');
			});
		}
	});
	
	$("button").button();
});
</script>